using System.Collections;
using Slaks.GraphExtensions.Containers;
using Slaks.Graphs;

namespace Slaks.GraphExtensions
{
	public class SuperGraph
	{
		private SectionType2Graph m_sectionType2Graph;
		private string m_name;
		private string m_category;
		private bool m_isCategorySet;

		public SuperGraph()
		{
			m_sectionType2Graph = new SectionType2Graph();
		}

		public SuperGraph(string name)
		{
			m_sectionType2Graph = new SectionType2Graph();
			m_name = name;
		}

		public Graph GetGraphBySectionType(string sectionType)
		{
			return m_sectionType2Graph[sectionType];
		}

		public bool AddGraph(Graph graph, string sectionType)
		{
			if (m_sectionType2Graph.Contains(sectionType) == false)
			{
				m_sectionType2Graph.Add(sectionType, graph);
				return true;
			}
			return false;
		}

		public ICollection GetGraphs()
		{
			return m_sectionType2Graph.Values;
		}

		/// <summary>
		/// Get or set the name of the supergraph
		/// </summary>
		public string Name
		{
			get { return m_name; }
			set { m_name = value; }
		}


		/// <summary>
		/// Get or set the category of the supergraph
		/// </summary>
		public string Category
		{
			get { return m_category; }
			set
			{
				m_category = value;
				m_isCategorySet = true;
			}
		}

		/// <summary>
		/// Find out whether the category of the supergraph was set or not
		/// </summary>
		/// <returns></returns>
		public bool IsCategorySet()
		{
			return m_isCategorySet;
		}
	}
}